<?php
class Application_Form_Circuit extends Zend_Form
{
	public function init()
	{
		$paysDAO = new Application_Model_PaysDAO();
		$pays = $paysDAO->findAll();
		$paystab = array();
		foreach($pays as $p)
		{
			$paystab[$p->getPayNum()] = $p->getPayNom();
		}
		
		$this->setName('addCircuit');
		$this->setMethod('post');
		$this->addAttribs(array('class'=>'form'));
        
		$this->addElement(
            'hidden', 'cirnum', array(
        ));
		
		$this->addElement(
            'text', 'cirnom', array(
                'label' => 'Nom du Circuit :',
                'required' => true,
                'filters'    => array('StringTrim')
            ));
 		
       	$this->addElement('select', 'paynum',
                          array('MultiOptions' => $paystab,
                                  'required' => true,
                                  'label' => 'Pays :')
                          );    
        
        $this->addElement('text', 'cirlongueur', array(
            'label' => 'Longueur :',
            'required' => true,
        	'validators' => array(
                'int'
            )
            ));
            
        $this->addElement('text', 'cirnbspectateurs', array(
            'label' => 'Nb de spectateurs :',
            'required' => true,
        	'validators' => array(
                'int'
            )
            ));
            
        $this->addElement('text', 'ciradresseimage', array(
            'label' => 'Adresse de l\'image :',
            'required' => true
            ));
 		
        $this->addElement('textarea', 'cirtext', array(
            'label' => 'Texte :',
            'required' => false,
        	'cols' => 30,
        	'rows' => 5
            ));
            
        $this->addElement('submit', 'submit', array(
            'ignore'   => true,
            'label'    => 'Valider'
            ));
	}
}